 var isUpProductBuy = false;
var isDownProductBuy = false;
 
function search() {
	var orderNo = document.getElementsByName("orderNo")[0].value;
	 
	var startDate = $('#startDate').val();
	var endDate = $('#endDate').val();
	 
	if (orderNo != '' && isNaN(orderNo)) {
		layer.alert("输入的商品编号有误，请重新输入！");
		return;
	}
	if ((startDate.length != 0 && startDate != '')
			&& (endDate.length != 0 && endDate != '')) {
		var startTime1 = startDate.slice(0, 4) + startDate.slice(5, 7)
				+ startDate.slice(8, 10);
		var endTime1 = endDate.slice(0, 4) + endDate.slice(5, 7)
				+ endDate.slice(8, 10);
		var timeValue1 = endTime1 - startTime1;
		if (timeValue1 < 0) {
			layer.alert("结束时间必须大于或等于开始时间!");
			return;
		}
	}
	// **** 功能 方法 *******
	initPage();
	layer.load(1);
	$(query_order_form).submit();
}
function refresh(){
	$(query_order_form).submit();
}
function toIsEmpty() {
	$("#startDate").val("");
	$("#endDate").val("");
	$("#state").val("");	
	$("#orderNo").val("");
	$("#prodType").val("");
	$("#xn_phone").val("");
	$("#recName").val("");
	$("#prodName").val("");
	$("#memberNo").val("");
	$("#memberType").val("");
	$("#orderSource").val("");
	$("#otherType").val("");
	//$('#query_order')[0].reset();
}

function initPage() {
	document.getElementById("page").value = '1';
}
function trims(str) {
	return str.replace(/^\s+|\s+$/g, "");
}
 
/*审核*/
 function audit_product(title,url,id,w,h){
	        var index = layer.open({
	            type: 2,
	            title: title,
	            content: url
	        });
	        layer.full(index);
	    }
 
 /*查看*/
 function look_product(title,url,id,w,h){
	        var index = layer.open({
	            type: 2,
	            title: title,
	            content: url
	        });
	        layer.full(index);
	    }
 
 
 /*编辑*/
 function edit_product(title,url,id,w,h){
	        var index = layer.open({
	            type: 2,
	            title: title,
	            content: url
	        });
	        layer.full(index);
	    }
 
 function thisValueForState(obj){
	 
	 $("#cancleMileageInfoQo.state").val(obj);
 }


 function searchOrderDatil(id ) {
	        var index = layer.open({
	            type: 2,
	            title: ' ',
	            scrollbar: false,
	            content: path+"/order/query_order_detai_list?id="+id,
	            area: ['1000px', '602px']
	        });
 } 
 
//-------------- 校验订单 ------------------
 function checkOrderState(state,id){
 	var datasMap ={"orderType":state,"orderNo":id} 
 	layer.confirm("是否校验该笔订单？",function(){
 	 	$.ajax({
 	   		url:path+"/order/check_order",
 	   		data:datasMap,
 	   		type:"post",
 	   		dataType:"text",
 	   		success:function(message){
 	   		layer.msg(message,{icon:1,time:1500},function(){
 	   		window.location.href = window.location.href;
 	   		});
 	   			
 	   	 	},
 	   		error:function(){
 	   		 
 	   		 alert(message)
 	   		}
 	   	});	
 	});

 	//-----------end -------------
 } 
 
function updatePackage(id ) {
	
	$.ajax({
 		url:path+"/order/cancle_mileage",
 		data:{"id":id}, 
 		type:"post",
 		dataType:"text",
 		success:function(message){
 			
 			if(message!="-1"){
 				layer.msg(message ,{icon:1,time:1500},function(){});
 				
 			}else{
 				layer.msg('退还失败！',{icon:1,time:1000},function(){});
 			}
 			
 		},
 		error:function(){
 			layer.msg('退还失败!',{icon:1,time:1000},function(){});
 			$("#"+no).show();
 		}
 	});	
	
	
}

/*导出*/
function slimport(path){
	 var form_path= $("#query_order").attr("action");
    $("#query_order").attr("action",path + "/order/order_list_excel").submit();
    $("#query_order").attr("action",form_path);
}
/*导出*/
function slimportOther(path){
	 var form_path= $("#query_order").attr("action");
    $("#query_order").attr("action",path + "/order/order_other_list_excl").submit();
    $("#query_order").attr("action",form_path);
}

